#include <QSplitter>
#include "PlayList.h"

PlayList::PlayList(QWidget *parent)
    : QWidget(parent)
    , m_menuBar()
    , m_playList()
    , m_playListContent()
    , m_mainLyt(this)
{
    initView();
}

void PlayList::initMenuBar()
{
    initMenus();
    m_menuBar.addMenu(&m_addMenu);
    m_menuBar.addMenu(&m_removeMenu);
    m_menuBar.addMenu(&m_listMenu);
    m_menuBar.addMenu(&m_sortMenu);
    m_menuBar.addMenu(&m_searchMenu);
    m_menuBar.addMenu(&m_editMenu);
    m_menuBar.addMenu(&m_playModeMenu);
}

void PlayList::initView()
{
    initMenuBar();
    m_playList.addTab(&m_playListContent, QString::fromUtf8("默认列表"));
    m_mainLyt.addWidget(&m_playList);
    m_mainLyt.addWidget(&m_menuBar);
}

void PlayList::initMenus()
{
    initAddMenu();
    initRemoveMenu();
    initListMenu();
    initSortMenu();
    initSearchMenu();
    initEditMenu();
    initPlayModeMenu();
}

void PlayList::addFiles()
{

}

void PlayList::addFold()
{

}

void PlayList::removeSelectFiles()
{

}

void PlayList::removeAllFiles()
{

}

void PlayList::addNewPlayList()
{

}

void PlayList::addPlayList()
{

}

void PlayList::openPlayList(){

}

void PlayList::savePlayList(){

}

void PlayList::removePlayList()
{

}

void PlayList::saveAllPlayList()
{

}

void PlayList::sortByDisplayTitle()
{

}

void PlayList::sortByFileName()
{

}

void PlayList::sortByFilePathName()
{

}

void PlayList::sortByFileDate()
{

}

void PlayList::sortByPlayTime()
{

}

void PlayList::sortByRandom()
{

}

void PlayList::searchSong()
{

}

void PlayList::searchNext()
{

}

void PlayList::editCut()
{

}

void PlayList::editCopy()
{

}

void PlayList::editPaste()
{

}

void PlayList::editMoveToList()
{

}

void PlayList::editCopyToList()
{

}

void PlayList::editSelectAll()
{

}

void PlayList::editDiselectAll()
{

}

void PlayList::editSelectOpp()
{

}

void PlayList::modeSingleLoop()
{

}

void PlayList::modeSinglePlay()
{

}

void PlayList::modePlayQueue()
{

}

void PlayList::modePlayLoop()
{

}

void PlayList::modePlayRandom()
{

}

void PlayList::initAddMenu()
{
    m_addMenu.setTitle(QString::fromUtf8("添加"));
    m_addMenu.addAction(QString::fromUtf8("文件..."), this, SLOT(addFiles()));
    m_addMenu.addAction(QString::fromUtf8("文件夹..."), this, SLOT(addFold()));
}

void PlayList::initRemoveMenu()
{
    m_removeMenu.setTitle(QString::fromUtf8("删除"));
    m_removeMenu.addAction(QString::fromUtf8("选中的文件"), this, SLOT(removeSelectFiles()));
    m_removeMenu.addSeparator();
    m_removeMenu.addAction(QString::fromUtf8("全部删除"), this, SLOT(removeAllFiles()));
}

void PlayList::initListMenu()
{
    m_listMenu.setTitle(QString::fromUtf8("列表"));
    m_listMenu.addAction(QString::fromUtf8("新建列表"), this, SLOT(addNewPlayList()));
    m_listMenu.addAction(QString::fromUtf8("添加列表..."), this, SLOT(addPlayList()));
    m_listMenu.addAction(QString::fromUtf8("打开列表..."), this, SLOT(openPlayList()));
    m_listMenu.addAction(QString::fromUtf8("保存列表..."), this, SLOT(savePlayList()));
    m_listMenu.addAction(QString::fromUtf8("删除列表..."), this, SLOT(removePlayList()));
    m_listMenu.addSeparator();
    m_listMenu.addAction(QString::fromUtf8("保存所有列表..."), this, SLOT(saveAllPlayList()));
}

void PlayList::initSortMenu()
{
    m_sortMenu.setTitle(QString::fromUtf8("排序"));
    m_sortMenu.addAction(QString::fromUtf8("按显示标题"), this, SLOT(sortByDisplayTitle()));
    m_sortMenu.addAction(QString::fromUtf8("按文件名"), this, SLOT(sortByFileName()));
    m_sortMenu.addAction(QString::fromUtf8("按路径名"), this, SLOT(sortByFilePathName()));
    m_sortMenu.addAction(QString::fromUtf8("按文件时间"), this, SLOT(sortByFileDate()));
    m_sortMenu.addAction(QString::fromUtf8("按播放长度"), this, SLOT(sortByPlayTime()));
    m_sortMenu.addSeparator();
    m_sortMenu.addAction(QString::fromUtf8("随机乱序"), this, SLOT(sortByRandom()));
}

void PlayList::initSearchMenu()
{
    m_searchMenu.setTitle(QString::fromUtf8("查找"));
    m_searchMenu.addAction(QString::fromUtf8("查找歌曲..."), this, SLOT(searchSong()));
    m_searchMenu.addAction(QString::fromUtf8("查找下一个"), this, SLOT(searchNext()));
}

void PlayList::initEditMenu()
{
    m_editMenu.setTitle(QString::fromUtf8("编辑"));
    m_editMenu.addAction(QString::fromUtf8("剪切"), this, SLOT(editCut()));
    m_editMenu.addAction(QString::fromUtf8("复制"), this, SLOT(editCopy()));
    m_editMenu.addAction(QString::fromUtf8("粘贴"), this, SLOT(editPaste()));
    m_editMenu.addSeparator();
    m_editMenu.addAction(QString::fromUtf8("移动到列表..."), this, SLOT(editMoveToList()));
    m_editMenu.addAction(QString::fromUtf8("复制到列表..."), this, SLOT(editCopyToList()));
    m_editMenu.addSeparator();
    m_editMenu.addAction(QString::fromUtf8("全部选中"), this, SLOT(editSelectAll()));
    m_editMenu.addAction(QString::fromUtf8("全部不选中"), this, SLOT(editDiselectAll()));
    m_editMenu.addAction(QString::fromUtf8("反向选中"), this, SLOT(editSelectOpp()));
}

void PlayList::initPlayModeMenu()
{
    m_playModeMenu.setTitle(QString::fromUtf8("模式"));
    m_playModeMenu.addAction(QString::fromUtf8("单曲播放"), this, SLOT(modeSinglePlay()));
    m_playModeMenu.addAction(QString::fromUtf8("单曲循环"), this, SLOT(modeSingleLoop()));
    m_playModeMenu.addAction(QString::fromUtf8("顺序播放"), this, SLOT(modePlayQueue()));
    m_playModeMenu.addAction(QString::fromUtf8("循环播放"), this, SLOT(modePlayLoop()));
    m_playModeMenu.addAction(QString::fromUtf8("随机播放"), this, SLOT(modePlayRandom()));
}
